﻿package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2016092100565041";

	// 商户私钥，您的PKCS8格式RSA2私钥
	public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQChrO15FlpEDiW3Y7kQaB92TzbgPoc/N9aHgj90GL/vC/ROt0QgfJp7fEDIB5RDwol5dZaL4EtTkFdWDpLiklWzTPriQ0bv/9/azTK2EbQIFWgZOUgL72WMZwNE99AVuxIyyUGgD9KUbj3skGOu8tZyVg4bBP3/TZvT0env1SjIfuM8CIVZDaF70TvakYzuxLIZbxt+FsDsm+ZpOma0gYm3Vxt15/J6FghPDmXqjUfd1eB2IdwcqHmNwgl5sifBVsVbg3QVYJJ6pQXxoj2VK71cWWJCxzddxwLK8HPETHmdgARDiTsQg+GR8YOTTdCK+W2TYKNKrIsfWVHzJWp+LcONAgMBAAECggEAMk+HzoiAKnFklz73Ff3w3HYmE34hxDByF9UWPeB9ybukmOI61wkvYYH2/sgtATEGar+Gy5xOlIB0TRlX6B21gYhRAhwBdSng1UvJnhLAPUu8Cy1iGCS1Kw3bXJjpLfn63cb3HwINe5caugTsoEJ9LTNOTGYvTEUwWqgV7kYc3NbvXZ4ZTS1ZtoqghaY5mRTk59ErSzdU9tNl7Ja1htAIRPXAqnfyfGbUKuaG57Yctx305Uqh93uBXt2YY76b/uB01EADkhFb52hMUcq8hHE7r6/g7TSt60badh66oyh/oD4nB8SjuJKNn84vHII4Nrlf7ojYhOqr1SfY8U3n7tryQQKBgQDuAAD3VlaRmlxsjpVTVqbRWQqgKEc3kNPCt8FZgFKA/1tZn7ufARlPUWZEMUkvP6srfKScN/KhKvgmBSHmn6Nrkbwcu83pTSxi1F65WfJrKWnTUb6fk6aBjna3t5uey2+rug4YJqGBmAdQfvmCu+4GHYISpt/1/FQuwCvs0TwIRQKBgQCt5y4ODq6j+puPJiRaVyNAKxbxObW51cojcT7HyxkUDcsh9mab30zm9lelbHsYxzSscrqxHg7IduLNa8oGd3rq3RL8cS94PM7gsmBvIMQTwA8O1w3tH5nq/j/U+w11de4CwLeSUPa1NGNFf4NEYeQuZZ3ODPnWlrwnoNmxIdL2qQKBgFyrZ7Tmy0JaZk5mnkIa5U1ybC68QC6kl6+juQdObdGInFsjVPyugtpdiYJX5nUdR1rhZ37kUfbrMkArk22nDwydbC+L+Ls0r2mz40YsfbW4JFqB48Viylx7ykHyngeQkuS8xywkLpK1TXPMXP7Iif+bkcANdfrjyyuA7BmDxuo5AoGASHQ+OvshBg7+yviAQud1N2H8kAqUTVXmfzfKiWF0FGfez0qi26SAnOXcBH8bFmrA5mxyniLA1AK8Ygvbwy/6lWoAZA8gUP88zl9jUEmdiAEIBQ3Sro3xCfheTfU/WUYGIT17/kkfUMX/6k/DODV05WPPCK9dVGu+/t/Ec0l9ZOkCgYEA6m2ZGrV9uYVAzD6ErR+NzYLRHAA/xILJX/FxVptHSn3wMF/yVU5B+o/aat2CcNDKrGxF1puhJ48qCnaD+5kSBGrsdkjd1qWoiBbZqi2nTKCejeKTPzZQy2yY3Poq/05JtTSFg0arsJkDvFlzwpeO3vKprukkkhQe+7w63vpB5Uk=";

	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
	public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6Q+qsIMruThfHAc+q9CGZ8hK28MbpVDdN0CdN2GtdJER0JgNwKZSfIVDiGw1oLvOz8jiL579dT+gcQwZOfd0xDeODjd7Vjq8lr52Ikrdv/eEGquEfYx219puqz1DEag9AhOT0asf3vmXULQi1Yl16KA/eLVgvTXa4gQTYDlzQU3jpGjtixgiXNaFy0N7EV0XrAKM/WFfDUu7Qh8XdgmJLegKxCQtcWfxZR52qVzK8/zFVZoIgGbtoP044P0Y6XdHidvQ4qgcflESvIHNrgz2YFqaTVjDtm6RQ1mpj6NN/+LitfcdnhHOFTqt95//NAsTSst8A0F6TXqEo+ukw8FD2QIDAQAB";

	// 服务器异步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://localhost:8080/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://localhost:8080/alipay.trade.page.pay-JAVA-UTF-8/return_url.jsp";

	// 签名方式
	public static String sign_type = "RSA2";

	// 字符编码格式
	public static String charset = "utf-8";

	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

	// 支付宝网关
	public static String log_path = "C:\\";

//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

	/**
	 * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
	 * 
	 * @param sWord 要写入日志里的文本内容
	 */
	public static void logResult(String sWord) {
		FileWriter writer = null;
		try {
			writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis() + ".txt");
			writer.write(sWord);
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			if (writer != null) {
				try {
					writer.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}
	}
}
